package com.malinkovic.math;

import java.io.FileWriter;
import java.io.IOException;
import java.util.Random;

public class Main{
	public static void main(String[] args){
        int numberLimit = 90;
        int exerciseLimit = 2000;
        int switchNumber;
        String signSymbol;
        Random random = new Random();
        
        try{
            FileWriter outputStream = new FileWriter("priklady.txt");
            for(int i = 0; i < exerciseLimit; i ++){
                int firstNumber = random.nextInt(numberLimit);
                int secondNumber = random.nextInt(numberLimit - firstNumber);
                boolean sign = random.nextBoolean();
                
                if(sign){
                    signSymbol = "+";
                }
                else{
                    signSymbol = "-";
                }
                
                if(secondNumber > firstNumber){
                    switchNumber = secondNumber;
                    secondNumber = firstNumber;
                    firstNumber = switchNumber;
                }
                
                outputStream.write(firstNumber + " " + signSymbol + " " + secondNumber + " = \n");
            }
            
            outputStream.close();
        }
        catch(IOException ex){
            ex.printStackTrace();
        }
    }
}
